package com.huayi.gg.service;

import android.os.Handler;
import android.os.Message;

import com.huayi.gg.config.API;
import com.huayi.gg.utils.HttpClient;

import okhttp3.FormBody;


public class IndexService {

	public static void getConfig(final Handler handler,String mac, final int what) {
		new Thread() {
			public void run() {
				FormBody.Builder params = new FormBody.Builder();

				params.add("mac",mac);

				String str = HttpClient.doPost(API.http + "/getcode", params);
				Message msg = new Message();
				msg.what = what;
				msg.obj = str;
				handler.sendMessage(msg);

			};
		}.start();
	}

	public static void getData(final Handler handler,String url, final int what) {
		new Thread() {
			public void run() {

				String str = HttpClient.doGet(url);
				Message msg = new Message();
				msg.what = what;
				msg.obj = str;
				handler.sendMessage(msg);

			};
		}.start();
	}

}
